package com.darwin.darwinUtils
{
	/**
	 * 时间工具类 
	 * @author vanCopper
	 * 
	 */	
	public class TimeUtil
	{
		public function TimeUtil()
		{
		}
		
		/**
		 * 获取倒计时字符串 格式 00:00:00 
		 * @param totalSecond
		 * @return 
		 * 
		 */		
		public static function getTimeStr(totalSecond:int):String
		{
			return getHour(totalSecond) + ":" + getMinutes(totalSecond) + ":" + getSecond(totalSecond);
		}
		
		/**
		 * 获取小时数 
		 * @param totalSecond
		 * @return 
		 * 
		 */		
		public static function getHour(totalSecond:int):String
		{
			var hour:int = Math.floor(totalSecond/3600);
			if(hour<10){return "0"+hour;}
			
			return ""+hour;
		}
		
		/**
		 * 获取分钟数 
		 * @param totalSecond
		 * @return 
		 * 
		 */		
		public static function getMinutes(totalSecond:int):String
		{
			var minutes:int = Math.floor((totalSecond%3600)/60);
			if(minutes < 10){return "0"+minutes;}
			return "" + minutes;	
		}
		
		/**
		 * 获取剩余的秒数 
		 * @param totalSecond
		 * @return 
		 * 
		 */		
		public static function getSecond(totalSecond:int):String
		{
			var second:int = (totalSecond%3600)%60;
			if(second < 10){return "0"+second;}
			return "" + second;
		}
										 
		
		
	}
}